# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=xtensor
pkgver=0.24.7
pkgrel=0
pkgdesc="C++ tensors with broadcasting and lazy computing"
url="https://github.com/xtensor-stack/xensor"
arch="noarch !s390x" # test failure on s390x
license="BSD-3-Clause"
makedepends="cmake samurai doctest-dev xtl nlohmann-json"
source="$pkgname-$pkgver.tar.gz::https://github.com/xtensor-stack/xtensor/archive/refs/tags/$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DBUILD_TESTS="$(want_check && echo ON || echo OFF)" \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}


sha512sums="
1b2683225a400e2ed06679eedc13c001be80163afb8b42918091670995c04f26ef03ffa9ef72ec7fe6c9d4c1aa88df9ad17698abe5ccd8b19a057ebc10956594  xtensor-0.24.7.tar.gz
"
